package com.aizuda.boot.modules.common.constant.enums;

/**
 * 协商节点状态枚举
 * @author system
 * @createTime 2024
 */
public enum NegotiationNodeStatusEnum {

    NOT_START("NOT_START", "未开始"),
    PROCESSING("PROCESSING", "处理中"),
    COMPLETED("COMPLETED", "已完成");

    private String code;
    private String msg;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    private NegotiationNodeStatusEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 根据code获取枚举值
     * @param code 状态码
     * @return 对应的枚举值
     */
    public static NegotiationNodeStatusEnum getByCode(String code) {
        for (NegotiationNodeStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 根据msg获取枚举值
     * @param msg 状态描述
     * @return 对应的枚举值
     */
    public static NegotiationNodeStatusEnum getByMsg(String msg) {
        for (NegotiationNodeStatusEnum status : values()) {
            if (status.getMsg().equals(msg)) {
                return status;
            }
        }
        return null;
    }
} 